//给需要检查城市信息的页面提供方法
var getCityAll = require('getCity.js');

var check = function (callback){
  wx.getStorage({
    key: "selectCity",
    success: function (res) {
      var city = JSON.parse(res.data)
      callback(city);
    },
    fail: function () {
      getCityAll.getSingleCity.then(function (city) {
        wx.setStorage({
          key: "selectCity",
          data: JSON.stringify(city)
        })
        callback(city);
      })
    }
  });
}

module.exports = {
  check: check
}